package Arrays101.Day06;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public class Day06_3 {
    public static void main(String[] args) {
        List<Integer> disappearedNumbers = findDisappearedNumbers(new int[]{4,3,2,7,8,2,3,1});
        System.out.println(disappearedNumbers);

    }
    public static List<Integer> findDisappearedNumbers(int[] nums){
        HashSet<Integer> set = new HashSet<>();
        ArrayList<Integer> list1 = new ArrayList<>();
        ArrayList<Integer> list2 = new ArrayList<>();
        for (int i = 0; i < nums.length; i++) {
            set.add(nums[i]);
        }
        for (int i = 1; i < nums.length+1; i++) {
            list1.add(i);
        }
        for (int i = 0; i < list1.size(); i++) {
            if (!set.contains(list1.get(i))){
                list2.add(list1.get(i));
            }
        }

        return list2;
    }
}
